﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainigWorkshop.Model;

namespace TrainigWorkshop.DAL_EF.ModelTranslation
{
    class StudentEFTranslator
    {
        public static List<StudentModel> ToStudentModel(List<Student> inputList)
        {
            List<StudentModel> studentModelList = new List< StudentModel>();
            foreach (Student s in inputList)
            {
                Grade grades = new Grade();
                StudentModel studentModel = new StudentModel(grades);
                studentModel.StudentId = s.StudentId;
                studentModel.StudentName = s.StudentName;
                studentModel.StudentGender = s.StudentGender;
                studentModel.grades.ClassName = s.Class.ClassName;
                studentModelList.Add(studentModel);
            }
            return studentModelList;
        }

        public static   StudentModel   ToStudentModel(Student stu)
        {
            Grade grade = new Grade();
            grade.ClassId = stu.ClassId;
            StudentModel result = new StudentModel(grade);
            result.StudentId = stu.StudentId;
            result.StudentGender = stu.StudentGender;
            result.StudentName = stu.StudentName;
            return result;
        }
     }
}